import { baseApi, baseRequst } from './config.js'

// 白名单 不用加密
const whiteList = []

export default async function(obj) {
	return new Promise((resolve, reject) => {
		const opt = {
			url: (obj.baseUrl||baseRequst) + obj.url,
			method: obj.method,
			timeout: obj.timeout || 30000,
			header: {
				'Content-Type': 'application/json;charset=UTF-8',
				...obj.header
			},
			data: obj.data,
			success: res => {
				resolve(res.data)
			},
			fail: (err) => {
				reject(err)
			}
		}
		uni.request(opt)
	})
}
